<?php
	$data             = array();
	$db               =  new model_meterials;
	$data['title']    = "Nhóm sản phẩm";
	$data['template'] = "meterials/add_meterials";
	$data['act']      = 0;
	$data['group']    = $db->list_group();
	$data['provider'] = $db->list_provider();
	if(isset($_POST['ok'])){
		$data = array(
			"tennguyenlieu"    => $_POST['meterialstname'],
			"donvitinh"        => $_POST['unit'],
			"dongia"           => $_POST['price'],
			"manhomnguyenlieu" => $_POST['group'],
			"manhacungcap"     => $_POST['provider'],
		);
		$db->add_meterials($data);
		header('location:index.php?mod=meterials&act=list');
	}else{
		loadview("layout",$data);
	}